/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package nesemulator;

/**
 *
 * @author ebenj
 */
public  class NesUtil {
    //where digit is 0-7 from most significant to least
    public static int BitAt(byte n, int digit){
        return (n>> (7-digit))&1;
    }
    public static int BitsAt(byte n, int digit, int numDigits){
        int total = 0;
        for(int i = 0; i<numDigits; i++){
            total*=2;
            total+=BitAt(n,digit+i);
        }
        return total;
    }
}
